<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:cc="http://java.sun.com/jsf/composite"
    xmlns:trh="http://myfaces.apache.org/trinidad/html">
    
<cc:interface>
     <cc:attribute name="to" required="true"/>  
</cc:interface>
<cc:implementation>
<trh:script type="text/javascript">
//TODO: tratar conteiner (subform e etc.), usando cc.clientId como referência

if (typeof window.onload != 'function') {
    window.onload = function(){
        document.getElementById('#{cc.attrs.to}').focus();
    }
}
else {
    var oldonload = window.onload;
    window.onload = function() {
        oldonload();
        document.getElementById('#{cc.attrs.to}').focus();
    }
}

</trh:script>
</cc:implementation>
</html>